home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_351 / pdc / libsrc.lzh / LibSrc / Misc / wb_parse.c < prev   
C/C++ Source or Header  |  1990-04-07  |  2KB  |  59 lines

  1. /*
  2.  * PDC I/O Library Copyright (C) 1987 by J.A. Lydiatt.
  3.  * Freely Distributable for non-commercial use.
  4.  */
  5. /*
  6.  *    This module is called from _main().  It will open a window for
  7.  *    standard I/O to use if the ToolType, "WINDOW" is defined.  The
  8.  *    window size and title can be specified in the tool definition.
  9.  *    If you don't ever plan to call this program from workbench, you
  10.  *    may replace this module by a dummy stub - try _wb_parse(){} for
  11.  *    example.
  12.  */
  13.  
  14. #include <libraries/dosextens.h>
  15. #include <workbench/workbench.h>
  16. #include <workbench/startup.h>
  17. #include <workbench/icon.h>
  18.  
  19. typedef struct DiskObject DISKOBJ;
  20. typedef struct Process PROCESS;
  21. typedef struct FileHandle HANDLE;
  22. typedef struct WBStartup WBSTART;
  23. typedef struct WBArg WBARG;
  24.  
  25. extern void *IconBase;
  26. extern void CloseLibrary(), FreeDiskObject();
  27. extern DISKOBJ *GetDiskObject();
  28.  
  29. _wb_parse(processp, wbMsg)
  30. register PROCESS *processp;
  31. WBSTART *wbMsg;
  32. {
  33.     register char *cp;
  34.     register DISKOBJ *diskobjp;
  35.     register HANDLE    *handlep;
  36.     register ULONG window;
  37.     WBARG *wbMsgp;
  38.     extern void *OpenLibrary();
  39.     extern long Open();
  40.  
  41.     if ( !(IconBase = OpenLibrary("icon.library", 0L)) )
  42.         return;
  43.     wbMsgp = wbMsg->sm_ArgList;
  44.     if ( !(diskobjp = GetDiskObject(wbMsgp->wa_Name)) )
  45.         goto done;
  46.     if (cp = FindToolType(diskobjp->do_ToolTypes, "WINDOW")) {
  47.         if (window = Open(cp, MODE_OLDFILE)) {
  48.             handlep =  window << 2;
  49.             processp->pr_ConsoleTask = handlep->fh_Type;
  50.             processp->pr_CIS = window;
  51.             processp->pr_COS = Open("*", MODE_OLDFILE);
  52.         }
  53.     }
  54.     FreeDiskObject(diskobjp);
  55. done:
  56.     CloseLibrary(IconBase);
  57.     IconBase = 0L;
  58. }
  59.